package com.power.sifa.flowable.api;


import com.plf.common.domain.ResponseDTO;
import com.plf.core.base.model.Ha_datasource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

public interface IFlowableSfapprove_toolFeign {

    /**
     * 计算除去工作日的任务耗时
     * @param starttime
     * @param endtime
     * @param result
     * @return
     */
    @PostMapping("/flowable/durationTime")
    Long durationTime(@RequestParam String starttime, @RequestParam String endtime, @RequestParam String result);

    /**
     * 保存流程表单数据
     *
     * @param body 表关系配置
     * @return applyid
     */
    @PostMapping("/flowable/saveFormData")
    ResponseDTO saveFormData(@RequestBody Map<String, Object> body) throws Exception;

    /**
     * 查看表单所用的数据源
     */
    @PostMapping("/flowable/datasourceView")
    Ha_datasource datasourceView(@RequestParam Integer id) throws Exception;

    /**
     * 执行流程按钮配置的服务
     * @param processinstanceid 流程实例id
     * @param taskid 流程任务id
     * @param stepid 流程步骤id
     * @param applyid 申请applyid
     * @param serveList 配置的服务列表
     * @return
     */
    @PostMapping("/flowable/executeService")
    ResponseDTO executeService(@RequestParam String processinstanceid, @RequestParam String taskid, @RequestParam String stepid, @RequestParam String applyid, @RequestBody List<Map<String, Object>> serveList);

    /**
     * 根据数据库名称查询数据源id
     * @param datasource
     * @return
     */
    @PostMapping("/flowable/getDatasourceByname")
    ResponseDTO getDatasourceByname(@RequestParam String datasource);


}
